package top.xbaoziplus.company.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.xbaoziplus.company.vo.AuditVo;
import top.xbaoziplus.company.common.Result;
import top.xbaoziplus.company.empty.UserInfo;
import top.xbaoziplus.company.service.AuditService;

import javax.servlet.http.HttpSession;

/**
 * @author xBaozi
 * @version 1.0
 * @classname AuditController
 * @description 审核控制器
 * @date 2022/6/29 9:23
 */
@RestController
@RequestMapping("/audit")
@Slf4j
@Api(tags = "审核模块")
public class AuditController {

    @Autowired
    AuditService auditService;

    @ApiOperation("管理员审核申请")
    @PostMapping("/admin/deal")
    public Result deal(@RequestBody @ApiParam("传申请ID和result原因和status状态") AuditVo auditVo,
                       HttpSession session){
        UserInfo info = (UserInfo) session.getAttribute("user");
        auditVo.setJobId(info.getJobId());
        return auditService.deal(auditVo);
    }

}
